package com.hhsjdesign.dynamicui.core.property.widget

import com.hhsjdesign.dynamicui.annoprocess.ADynamicUI
import com.hhsjdesign.dynamicui.annoprocess.AWidgetProperty
import com.hhsjdesign.dynamicui.core.property.WidgetSpecProperty
import com.hhsjdesign.dynamicui.core.widgetdata.WidgetTypeConst
import org.json.JSONObject


//横向翻页
@ADynamicUI
@AWidgetProperty(WidgetTypeConst.BANNER_SINGLE)
open class BannerSWidgetProperty : WidgetSpecProperty {

    constructor() {
        duration = 3000
        switchMode = 1
        cycleMode = 1
        indicatorLayoutType = 1
        indicatorProperty = BannerIndicatorProperty()
    }

    constructor(jo: JSONObject) : super(jo) {
        duration = jo.optInt("duration")
        switchMode = jo.optInt("switchMode")
        cycleMode = jo.optInt("cycleMode")
        indicatorLayoutType = jo.optInt("indicatorLayoutType")
        indicatorProperty = BannerIndicatorProperty(
            jo.optJSONObject("indicatorSelectColor") ?: JSONObject()
        )
    }

    //切换方式  自动、手动
    open var switchMode: Int = 0

    //切换间隔
    open var duration: Int = 0

    //循环方式 无限，来回
    open var cycleMode: Int = 0

    open var defaultBgUrl: String? = null

    // 0 表示浮在上面，1表示线性排列下面
    var indicatorLayoutType: Int = 0

    //指示器属性
    open var indicatorProperty: BannerIndicatorProperty? = null

}